home *** CD-ROM | disk | FTP | other *** search
- /* ILBMViewer - An example of using the dissidents rx_intui.library */
-
- /* Present File requester for user to pick the picture to load */
- /* Get a ReqDef structure */
- rq=rxi_GetReq()
- IF rq == '' | rq == 0 THEN SAY 'ReqDef allocation error'
-
- /* Do the File Requester with INFO_SUPPRESS. Since we pass 0 for screen, this */
- /* opens on WB. Note: If no ReqDef, this does nothing and returns path = null. */
- path=rxi_ReqWindow(rq,'Choose Picture File:',4096,,,,,,0)
-
- /* Free the ReqDef. If no ReqDef, this does nothing. */
- rq=rxi_EndReq(rq)
-
- IF path > '' THEN DO
-
- /* Let the lib open a window/screen for us, and load the picture. */
- wind=rxi_IFFLoad(0,0,path)
- IF wind == '' | wind == 0 THEN SAY 'Window open error'
-
- /* Trap the RIGHT MOUSE button so that we can use it for ourselves. We're */
- /* going to use the menu button to bring up the color requester, and the */
- /* select button to exit the program */
- err=rxi_ModIDCMP(wind,,,65536)
-
- /* Get the window's screen. If no window, this returns 0 for screen */
- screen=rxi_PEEK(wind,46,2)
-
- /* Here's our IDCMP loop. When the lib opens a window, it's default IDCMP is */
- /* MOUSEBUTTONS only. If no window (ie 0), this loop breaks out immediately. */
- class = 1
-
- DO WHILE class > 0
- spec=rxi_WaitMsg(wind)
- /* divide the spec into separate parts */
- PARSE var spec class part1 part2 part3
-
- IF class == 3 THEN DO
- /* If select DOWN, set class to 0 */
- IF part1 == 0 THEN class = 0
- /* If menu DOWN, bring up the color requester */
- IF part1 == 2 THEN err=rxi_Color(screen)
- END
-
- END
-
- /* Close the window that the lib opened, thus freeing any resources for it. */
- /* Note that if no window opened (ie 0), this does nothing. */
- wind=rxi_EndWindow(wind)
-
- /* Close the screen that the lib opened, thus freeing any resources for it. */
- /* Note that if no screen opened (ie 0), this does nothing. */
- screen=rxi_EndScreen(screen)
-
- END
-